/**
 * Chat Feature Styles
 * Chatbox, messages, input area
 */

/* Chatbox Container */
#chatbox {
    flex: 1;
    overflow-y: auto;
    padding: var(--content-padding);
    display: flex;
    flex-direction: column;
    gap: var(--gap-md);
    background-color: var(--background-color);
}

/* Message Base */
.message {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: var(--border-radius-md);
    line-height: 1.6;
    word-wrap: break-word;
    animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* User Message */
.user-message {
    align-self: flex-end;
    background-color: var(--user-msg-bg);
    color: var(--user-msg-text);
    border-bottom-right-radius: 4px;
}

/* Assistant Message */
.assistant-message {
    align-self: flex-start;
    background-color: var(--assistant-msg-bg);
    color: var(--assistant-msg-text);
    border-bottom-left-radius: 4px;
}

/* Streaming Message */
.assistant-message.streaming {
    position: relative;
}

.assistant-message.streaming::after {
    content: '▊';
    animation: blink 1s infinite;
    margin-left: 2px;
}

@keyframes blink {
    0%, 50% {
        opacity: 1;
    }
    51%, 100% {
        opacity: 0;
    }
}

/* System Message */
.system-message {
    align-self: center;
    background-color: var(--system-msg-bg);
    color: var(--system-msg-text);
    font-size: 0.9em;
    font-style: italic;
    max-width: 95%;
    text-align: center;
}

/* Error Message */
.error-message {
    align-self: center;
    background-color: var(--error-container);
    color: var(--on-error-container);
    max-width: 90%;
    border-left: 4px solid var(--error-color);
}

/* Message Content */
.message-content {
    word-break: break-word;
}

.message-content code {
    background-color: rgba(var(--outline-rgb), 0.1);
    padding: 2px 6px;
    border-radius: var(--border-radius-sm);
    font-family: 'JetBrains Mono', 'Cascadia Code', monospace;
    font-size: 0.9em;
}

.message-content pre {
    background-color: rgba(var(--outline-rgb), 0.08);
    border: 1px solid rgba(var(--outline-rgb), 0.2);
    border-radius: var(--border-radius-sm);
    padding: 12px;
    overflow-x: auto;
    margin: 8px 0;
}

.message-content pre code {
    background-color: transparent;
    padding: 0;
    font-size: 0.85em;
}

.message-content a {
    color: var(--primary-color);
    text-decoration: underline;
}

.message-content a:hover {
    opacity: 0.8;
}

/* Input Area */
#input-area {
    padding: var(--content-padding);
    background-color: var(--surface-color);
    border-top: 1px solid var(--sidebar-border);
    display: flex;
    gap: var(--gap-sm);
    align-items: flex-end;
}

#userInput {
    flex: 1;
    min-height: 44px;
    max-height: 200px;
    padding: 12px;
    border: 1px solid var(--input-border);
    border-radius: var(--border-radius-md);
    background-color: var(--input-bg);
    color: var(--text-color);
    font-family: inherit;
    font-size: inherit;
    resize: none;
    overflow-y: auto;
    transition: border-color var(--transition-speed);
}

#userInput:focus {
    outline: none;
    border-color: var(--input-focus-border);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.1);
}

#userInput:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .message {
        max-width: 95%;
    }

    #chatbox {
        padding: var(--gap-sm);
    }

    #input-area {
        padding: var(--gap-sm);
    }
}
